﻿<div id="leftContent">

<h1>Accounts</h1>
<p><a href="admin.php?acao=show&tabela=accounts">View</a></p>
<p><a href="admin.php?acao=add&tabela=accounts">Add</a></p>

<h1>Clusters</h1>
<p><a href="admin.php?acao=show&tabela=clusters">View</a></p>
<p><a href="admin.php?acao=add&tabela=clusters">Add</a></p>

</div>

<div id="mainContent">

<?php
	switch ( $tabela )
	{
		case "accounts":
			echo "<h1>Accounts: ";
			switch ( $acao )
			{
				case "show":
					echo "View</h1>";
					?>
						<table id="projectsTable" cellspacing="0">
						<tr class="header"><th class="spacer"></th><th class="name">User</th><th class="date">Owner</th><th class="name">Adm?</th><th class="source">Actions</th></tr>
					<?php
					for ($i=0; ($i < count($data)); $i++)
					{
					?>
						<tr class="item">
						<td><img src="images/spacer.gif" width="17px" height="35" /></td>
						<td class="name"><?=$data[$i]["accountUser"];?></td>
						<td><?=$data[$i]["accountOwner"];?></td>
						<td><?=$data[$i]["accountIsAdmin"];?></td>
						<td>
							<a href="admin.php?acao=edit&tabela=accounts&accountId=<?=$data[$i]["accountId"];?>"><img src="images/edit.png"></a>
							<a href="admin.php?acao=remove&tabela=accounts&accountId=<?=$data[$i]["accountId"];?>"><img src="images/remove.png"></a>
							<a href="admin.php?acao=admin&tabela=accounts&accountId=<?=$data[$i]["accountId"];?>"><img src="images/admin.png"></a>
						</td>
						</tr>
					<?php
					}
					?>
						</table>
					<?php
				break;
				case "add":
					echo "Add</h1>";
					?>
						<div id='submission'><center>
						<form action='admin.php?acao=insert&tabela=accounts' method='POST'>
							<table cellpadding='4' cellspacing='0'>
								<tr><td>User: </td><td><input type='text' id='accountUser' name='accountUser' class='bigField' /></td></tr>
								<tr><td>Password:</td><td><input type='text' id='accountPassword' name='accountPassword' class='bigField' /></td></tr>
								<tr><td>Owner: </td><td><input type='text' id='accountOwner' name='accountOwner' class='bigField' /></td></tr>
								<tr><td>e-mail: </td><td><input type='text' id='accountEmail' name='accountEmail' class='bigField' /></td></tr>
								<tr><td>Organization: </td><td><input type='text' id='accountOrganization' name='accountOrganization' class='bigField' /></td></tr>
								<tr><td>Telephone: </td><td><input type='text' id='accountTelephone' name='accountTelephone' class='bigField' /></td></tr>
								<tr><td colspan='2' align='right'><input type='submit' class='loginSubmit' value='submeter' /></td></tr>
							</table>
						</form>
						<font color='red'><?=$msg;?></font>
						</center></div>
					<?
				break;
				case "edit":
					echo "Edit</h1>";
					?>
						<div id='submission'><center>
						<form action='admin.php?acao=update&tabela=accounts' method='POST'>
							<input type='hidden' id='accountId' name='accountId' value='<?=$data["accountId"];?>' />
							<table cellpadding='4' cellspacing='0'>
								<tr><td>User: </td><td><input type='text' id='accountUser' name='accountUser' class='bigField' value='<?=$data["accountUser"];?>' /></td></tr>
								<tr><td>Password:</td><td><input type='text' id='accountPassword' name='accountPassword' class='bigField' value='<?=$data["accountPassword"];?>' /></td></tr>
								<tr><td>Owner: </td><td><input type='text' id='accountOwner' name='accountOwner' class='bigField' value='<?=$data["accountOwner"];?>' /></td></tr>
								<tr><td>e-mail: </td><td><input type='text' id='accountEmail' name='accountEmail' class='bigField' value='<?=$data["accountEmail"];?>' /></td></tr>
								<tr><td>Organization: </td><td><input type='text' id='accountOrganization' name='accountOrganization' class='bigField' value='<?=$data["accountOrganization"];?>' /></td></tr>
								<tr><td>Telephone: </td><td><input type='text' id='accountTelephone' name='accountTelephone' class='bigField' value='<?=$data["accountTelephone"];?>' /></td></tr>
								<tr><td colspan='2' align='right'><input type='submit' class='loginSubmit' value='submeter' /></td></tr>
							</table>
						</form>
						</center></div>
					<?
				break;
			}
		break;
		case "clusters":
			echo "<h1>Clusters: ";
			switch ( $acao )
			{
				case "show":
					echo "View</h1>";
					?>
						<table id="projectsTable" cellspacing="0">
						<tr class="header"><th class="spacer"></th><th class="name">Name</th><th class="name">ID</th><th class="name">Active?</th><th class="source">Actions</th></tr>
					<?php
					for ($i=0; ($i < count($data)); $i++)
					{
					?>
						<tr class="item">
						<td><img src="images/spacer.gif" width="17px" height="35" /></td>
						<td class="name"><?=$data[$i]["clusterName"];?></td>
						<td class="name"><?=$data[$i]["clusterId"];?></td>
						<td><?=$data[$i]["clusterActive"];?></td>
						<td>
							<a href="admin.php?acao=edit&tabela=clusters&clusterId=<?=$data[$i]["clusterId"];?>"><img src="images/edit.png"></a>
							<a href="admin.php?acao=remove&tabela=clusters&clusterId=<?=$data[$i]["clusterId"];?>"><img src="images/remove.png"></a>
							<a href="admin.php?acao=active&tabela=clusters&clusterId=<?=$data[$i]["clusterId"];?>"><img src="images/active.png"></a>
						</td>
						</tr>
					<?php
					}
					?>
						</table>
					<?php
				break;
				case "add":
					echo "Add</h1>";
					?>
						<div id='submission'><center>
						<form action='admin.php?acao=insert&tabela=clusters' method='POST'>
							<table cellpadding='4' cellspacing='0'>
								<tr><td>Name: </td><td><input type='text' id='clusterName' name='clusterName' class='bigField' /></td></tr>
								<tr><td>IP: </td><td><input type='text' id='clusterIP' name='clusterIP' class='bigField' /></td></tr>
								<tr><td>Operational System: </td><td><input type='text' id='clusterOperationalSystem' name='clusterOperationalSystem' class='bigField' /></td></tr>
								<tr><td>Scheduler: </td><td><input type='text' id='clusterScheduler' name='clusterScheduler' class='bigField' /></td></tr>
								<tr><td>Processor Model: </td><td><input type='text' id='clusterProcessorModel' name='clusterProcessorModel' class='bigField' /></td></tr>
								<tr><td>Nodes: </td><td><input type='text' id='clusterNumNode' name='clusterNumNode' class='bigField' /></td></tr>
								<tr><td>Processors/Node: </td><td><input type='text' id='clusterNumProcessorsPerNode' name='clusterNumProcessorsPerNode' class='bigField' /></td></tr>
								<tr><td colspan='2' align='right'><input type='submit' class='loginSubmit' value='submeter' /></td></tr>
							</table>
						</form>
						</center></div>
					<?
				break;
				case "edit":
					echo "Edit</h1>";
					?>
						<div id='submission'><center>
						<form action='admin.php?acao=update&tabela=clusters' method='POST'>
							<input type='hidden' id='clusterId' name='clusterId' value='<?=$data["clusterId"];?>' />
							<table cellpadding='4' cellspacing='0'>
								<tr><td>Name: </td><td><input type='text' id='clusterName' name='clusterName' class='bigField' value='<?=$data["clusterName"];?>' /></td></tr>
								<tr><td>IP: </td><td><input type='text' id='clusterIP' name='clusterIP' class='bigField' value='<?=$data["clusterIP"];?>' /></td></tr>
								<tr><td>Operacional System: </td><td><input type='text' id='clusterOperationalSystem' name='clusterOperationalSystem' class='bigField' value='<?=$data["clusterOperationalSystem"];?>' /></td></tr>
								<tr><td>Scheduler: </td><td><input type='text' id='clusterScheduler' name='clusterScheduler' class='bigField' value='<?=$data["clusterScheduler"];?>' /></td></tr>
								<tr><td>Processor Model: </td><td><input type='text' id='clusterProcessorModel' name='clusterProcessorModel' class='bigField' value='<?=$data["clusterProcessorModel"];?>' /></td></tr>
								<tr><td>Nodes: </td><td><input type='text' id='clusterNumNode' name='clusterNumNode' class='bigField' value='<?=$data["clusterNumNode"];?>' /></td></tr>
								<tr><td>Processors/Nodes: </td><td><input type='text' id='clusterNumProcessorsPerNode' name='clusterNumProcessorsPerNode' class='bigField' value='<?=$data["clusterNumProcessorsPerNode"];?>' /></td></tr>
								<tr><td colspan='2' align='right'><input type='submit' class='loginSubmit' value='submeter' /></td></tr>
							</table>
						</form>
						</center></div>
					<?
				break;
			}
		break;
	}
?>

</div>